<!DOCTYPE html>
<html lang="en">
<head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0 Access-Control-Allow-Origin:*">
      <!-- 引入 Bootstrap -->
      <link href="<?=  base_url("html/sample in bootstrap v3/bootstrap/css/bootstrap.min.css")?>" rel="stylesheet" media="screen">
      <link href="<?=  base_url("html/css/bootstrap-datetimepicker.min.css")?>" rel="stylesheet" media="screen">
      
	<title>Welcome to CodeIgniter</title>

	<style type="text/css">

	::selection{ background-color: #E13300; color: white; }
	::moz-selection{ background-color: #E13300; color: white; }
	::webkit-selection{ background-color: #E13300; color: white; }

	body {
		background-color: #fff;
		margin: 40px;
		font: 13px/20px normal Helvetica, Arial, sans-serif;
		color: #4F5155;
	}

	a {
		color: #003399;
		background-color: transparent;
		font-weight: normal;
	}

	h1 {
		color: #444;
		background-color: transparent;
		border-bottom: 1px solid #D0D0D0;
		font-size: 19px;
		font-weight: normal;
		margin: 0 0 14px 0;
		padding: 14px 15px 10px 15px;
	}

	code {
		font-family: Consolas, Monaco, Courier New, Courier, monospace;
		font-size: 12px;
		background-color: #f9f9f9;
		border: 1px solid #D0D0D0;
		color: #002166;
		display: block;
		margin: 14px 0 14px 0;
		padding: 12px 10px 12px 10px;
	}

	#body{
		margin: 0 15px 0 15px;
	}
	
	p.footer{
		text-align: right;
		font-size: 11px;
		border-top: 1px solid #D0D0D0;
		line-height: 32px;
		padding: 0 10px 0 10px;
		margin: 20px 0 0 0;
	}
	
	#container{
		margin: 10px;
		border: 1px solid #D0D0D0;
		-webkit-box-shadow: 0 0 8px #D0D0D0;
	}
        .submit{
            margin-top: 20px;
            margin-bottom: 20px;
        }
	</style>

</head>
<body>

<div id="container">
    <h1>统计报表</h1>
        <div class="form-group">
                <label for="dtp_input1" class="col-md-2 control-label">时间/月度</label>
                <div class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy/MM" data-link-field="dtp_input1">
                    <input id="date" class="form-control" size="16" type="text" value="" readonly>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
					<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                </div>
				<input type="hidden" id="dtp_input1" value="" /><br/>
        </div>
    <div class="form-group">
        <button type="button" class="btn btn-primary btn-block search">
                    查询
        </button>
    </div>
	<table class="table">
                <thead>
                    <tr>
                        <th>房间名称</th>
                        <th>入住日期</th>
                        <th>上月电</th>
                        <th>本月电</th>
                        <th>上月水</th>
                        <th>本月水</th>
                        <th>上月空调</th>
                        <th>本月空调</th>
                        <th>房租</th>
                        <th>电费</th>
                        <th>水费</th>
                        <th>空调费</th>
                        <th>总计</th>
                    </tr>
                </thead>
                
                <?php foreach($data as $value):?>
                    <tbody>
                        <tr>
                            <td><?=$value['homename']?></td>
                            <td><?=$value['checkinData']?></td>
                            <td><?=$value['lastmonth_dian']?></td>
                            <td><?=$value['dian']?></td>
                            <td><?=$value['lastmonth_shui']?></td>
                            <td><?=$value['shui']?></td>
                            <td><?=$value['lastmonth_kongtiao']?></td>
                            <td><?=$value['kongtiao']?></td>
                            <td><?=$value['charge']?></td>
                            <td><?=($value['dian']-$value['lastmonth_dian'])?></td>
                            <td><?=($value['shui']-$value['lastmonth_shui'])*5?></td>
                            <td><?=($value['kongtiao']-$value['lastmonth_kongtiao'])*1.2?></td>
                            <td><?=$value['charge']+($value['dian']-$value['lastmonth_dian'])+($value['shui']-$value['lastmonth_shui'])*5+($value['kongtiao']-$value['lastmonth_kongtiao'])*1.2?>(房间<?=$value['homeid']?>)</td>
                        </tr>
                    </tbody>
                <?php endforeach;?>
                
        </table>
    <div class="form-group">
        <button type="button" class="btn btn-primary btn-block submit">
                    数据录入
        </button>
    </div>
</div>
    <script type="text/javascript" src="<?=  base_url("html/jquery/jquery-1.8.3.min.js")?>" charset="UTF-8"></script>
    <script type="text/javascript" src="<?=  base_url("html/sample in bootstrap v3/bootstrap/js/bootstrap.min.js")?>"></script>
    <script type="text/javascript" src="<?=  base_url("html/js/bootstrap-datetimepicker.js")?>" charset="UTF-8"></script>
    <script type="text/javascript" src="<?=  base_url("html/js/locales/bootstrap-datetimepicker.zh-CN.js")?>" charset="UTF-8"></script>
   <script type="text/javascript">
       $(document).ready(function(){
            $(".submit").click(function(){
                 window.location.href = "<?=  base_url("create")?>"
            });
       })
       $(document).ready(function(){
            $(".search").click(function(){
                var month = $("#date").val();
                 window.location.href = "<?=  base_url("report?month=")?>"+month;
            });
       })
       
   </script>
<script type="text/javascript">
    $('.form_datetime').datetimepicker({
        minView:"month",
        format:'yyyy-mm',
        language: 'zh-CN',
        weekStart: 1,
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });
</script>
</body>
</html>